import clsx from 'clsx';
import Heading from '@theme/Heading';
import Link from "@docusaurus/Link";
import styles from './styles.module.css';
import { translate } from '@docusaurus/Translate';

type FeatureItem = {
  title: string;
  description: JSX.Element;
  button: string;
  link: string;
  logo: string;
  // Svg: React.ComponentType<React.ComponentProps<'svg'>>;
};

const FeatureList: FeatureItem[] = [
  {
    // title: 'Easy to Use',
    // Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default,
    // description: (
    //   <>
    //     Docusaurus was designed from the ground up to be easily installed and
    //     used to get your website up and running quickly.
    //   </>
    // ),
    title: translate({ message: 'homepage.panshi.title' }),
    // Svg: require('@site/static/logo/panshi/logo.svg').default,
    logo: 'logo/panshi/logo.png',
    description: (
      <>
       { translate({ message: 'homepage.panshi.desc' }) }
      </>
    ),
    button: translate({ message: 'homepage.link' }),
    link: "/docs/panshi/"
  },
  {
    title: translate({ message: 'homepage.qiyuan.title' }),
    logo: 'logo/qiyuan/logo.png',
    description: (
      <>
        { translate({ message: 'homepage.qiyuan.desc' }) }
      </>
    ),
    button: translate({ message: 'homepage.link' }),
    link: "/docs/qiyuan/"
    // Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default,
    // description: (
    //   <>
    //     Docusaurus lets you focus on your docs, and we&apos;ll do the chores. Go
    //     ahead and move your docs into the <code>docs</code> directory.
    //   </>
    // ),
  },
  {
    title: translate({ message: 'homepage.nichang.title' }),
    logo: 'logo/nichang/logo.png',
    description: (
      <>
        { translate({ message: 'homepage.nichang.desc' }) }
      </>
    ),
    button: translate({ message: 'homepage.link' }),
    link: "/docs/nichang/"
    // Svg: require('@site/static/img/undraw_docusaurus_react.svg').default,
    // description: (
    //   <>
    //     Extend or customize your website layout by reusing React. Docusaurus can
    //     be extended while reusing the same header and footer.
    //   </>
    // ),
  },
];

function Feature({title, logo, description, button, link}: FeatureItem) {
  const descriptionStyle = { 
    // height: "120px" 
  };
  return (
    <div className={clsx('col col--4')}>
      <div className={clsx('text--center ') + styles.featureImgBox}>
        {/* <Svg className={styles.featureSvg} role="img" /> */}
        <img src={logo} className={styles.featureImg} />
      </div>
      <div className="text--center padding-horiz--md">
        <Heading as="h3">{title}</Heading>
        <p className="text--center padding-horiz--md">
          <Link className={ clsx('button button--primary ') + styles.featureButton } to={link}>
              {button}
          </Link>
        </p>
        <p style={descriptionStyle}>{description}</p>
      </div>
    </div>
  );
}

export default function HomepageFeatures(): JSX.Element {
  return (
    <section className={styles.features}>
      <div className="container">
        <div className="row">
          {FeatureList.map((props, idx) => (
            <Feature key={idx} {...props} />
          ))}
        </div>
      </div>
    </section>
  );
}
